﻿using Shop.RemoteModel.PageTemplate;
using Shop.RemoteModel.PageTemplate.Model;
using Shop.StoreGatewayModular.Interface;
using WeDonekRpc.Client;
using WeDonekRpc.HttpApiGateway.Model;

namespace Shop.StoreGatewayModular.Service
{
    internal class PageTemplateService : IPageTemplateService
    {
        public void Delete ( long id )
        {
            new DeletePageTemplate
            {
                Id = id,
            }.Send();
        }
        public bool Set ( long id, PageTemplateSet data )
        {
            return new SetPageTemplate
            {
                Id = id,
                Datum = data
            }.Send();
        }
        public PageTemplateDto Get ( long id )
        {
            return new GetPageTemplate
            {
                Id = id,
            }.Send();
        }
        public PagingResult<PageTemplateDto> Query ( PagingParam<PageTemplateQuery> param )
        {
            return new QueryPageTemplate
            {
                Index = param.Index,
                Size = param.Size,
                SortName = param.SortName,
                IsDesc = param.IsDesc,
                NextId = param.NextId,
                Query = param.Query,
            }.Send();
        }
        public bool Enable ( long id )
        {
            return new EnablePageTemplate
            {
                Id = id
            }.Send();
        }

        public long Add ( PageTemplateAdd datum )
        {
            return new AddPageTemplate
            {
                Datum = datum
            }.Send();
        }

    }
}
